////
////  DDJobfinderDetailViewController.m
////  DingDongZP
////
////  Created by Jyh on 16/5/2.
////  Copyright © 2016年 iyhjiang.com. All rights reserved.
////
//
//#import "DDJobfinderDetailViewController.h"
//#import "DDJobfindersService.h"
//#import "DDJobfinderInfoCell.h"
//#import "DDHighLightCell.h"
//#import "DDWorkExperienceCell.h"
//#import "DDEduExperienceCell.h"
//#import "DDJobfinderDetailInfo.h"
//#import "DDChatMessageViewController.h"
//#import "DDJobfinderDetailInfo.h"
//
//#import "DDBossChoosePositionViewController.h"
//
//#define kJobFinderDetailCellHeight    @154
//#define kHighlightCellHeight          @160
//#define kWorkExperienceCellHeight     @120
//#define kEduExperienceCellHeight      @118
//
//@interface DDJobfinderDetailViewController ()
//
//@property (strong, nonatomic) NSMutableArray *rowHeightArray;
//
//@property (strong, nonatomic) DDJobfindersService *jobFinderService;
//@property (weak, nonatomic) IBOutlet UIView *toolView;
//@property (weak, nonatomic) IBOutlet UIButton *interstingButton;
//@property (weak, nonatomic) IBOutlet UIButton *chatButton;
//
//@property (strong, nonatomic) DDJobfinderDetailInfo *detailInfo;
//
//- (IBAction)onBossInterestingButtonClick:(UIButton *)sender;
//- (IBAction)onBossChatButtonClick:(UIButton *)sender;
//
//@end
//
//@implementation DDJobfinderDetailViewController
//
//#pragma mark
//#pragma mark - View LifeCycle
//
//- (void)viewDidLoad
//{
//    [super viewDidLoad];
//    
//    self.jobFinderService = [[DDJobfindersService alloc] init];
//    
//    [self setupView];
//    [self setupData];
//}
//
//- (void)viewWillAppear:(BOOL)animated {
//    [super viewWillAppear:animated];
//    [self.rdv_tabBarController setTabBarHidden:false animated:true];
//}
//
//- (void)viewDidLayoutSubviews
//{
//    [super viewDidLayoutSubviews];
//    WEAKSELF
//    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.center.equalTo(weakSelf.view);
//        make.edges.mas_offset(UIEdgeInsetsMake(0, 0, 50, 0));
//    }];
//}
//
//#pragma mark
//#pragma mark - Private Methods
//
//- (void)setupData
//{
//    self.rowHeightArray = [[NSMutableArray alloc] init];
//    self.rowHeightArray = [NSMutableArray arrayWithArray:@[kJobFinderDetailCellHeight,kHighlightCellHeight,kWorkExperienceCellHeight,kEduExperienceCellHeight]];
//    
//    [self queryJobFinderDetailInfo];
//    
//    WEAKSELF
//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//        [weakSelf queryBossInterestStatus];
//    });
//}
//
//- (void)setupView
//{
//    [self.view bringSubviewToFront:self.toolView];
//    self.toolView.layer.borderWidth = 1;
//    self.toolView.layer.borderColor = COLOR_BORDER_GRAY.CGColor;
//    
//    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
//    
//    [self.tableView registerNib:[UINib nibWithNibName:@"DDJobfinderInfoCell" bundle:nil] forCellReuseIdentifier:@"DDJobfinderInfoCell"];
//    [self.tableView registerNib:[UINib nibWithNibName:@"DDHighLightCell" bundle:nil] forCellReuseIdentifier:@"DDHighLightCell"];
//    [self.tableView registerNib:[UINib nibWithNibName:@"DDWorkExperienceCell" bundle:nil] forCellReuseIdentifier:@"DDWorkExperienceCell"];
//    [self.tableView registerNib:[UINib nibWithNibName:@"DDEduExperienceCell" bundle:nil] forCellReuseIdentifier:@"DDEduExperienceCell"];
//    
//
//}
//
//- (void)queryBossInterestStatus
//{
//    WEAKSELF
//    if (!self.jobfinderId) {
//        return;
//    }
//    
//    [self.jobFinderService queryJobfindersInterestingStatusWithJobfindeId:self.jobfinderId successBlock:^(id responseObject) {
//        
//        if ([weakSelf isValidateResponseData:responseObject]) {
//            NSString *status = [NSString stringWithFormat:@"%@",responseObject[@"data"]];
//            
//            self.interstingButton.selected = [status isEqualToString:@"1"];
//            
//        } else {
//            [weakSelf responseUnValidate:responseObject];
//        }
//    } failBlock:^(id responseObject, NSError *error) {
//        [weakSelf requestFaild];
//    }];
//}
//
//- (void)markInterstStatus
//{
//    WEAKSELF
//    
//    [self.jobFinderService markJobfindersInterestingStatusWithJobfindeId:self.jobfinderId successBlock:^(id responseObject) {
//
//        if ([weakSelf isValidateResponseData:responseObject]) {
//            NSString *status = [NSString stringWithFormat:@"%@",responseObject[@"data"]];
//            
//            self.interstingButton.selected = [status isEqualToString:@"1"];
//            
//            if (self.interstingButton.selected == YES) {
//                
//                [[LDShowHUB shareInstance]showToastSucc:@"关注成功"];
//            }else{
//                
//                [[LDShowHUB shareInstance]showToastSucc:@"取消关注"];
//            }
//            
//        } else {
//            [weakSelf responseUnValidate:responseObject];
//        }
//    } failBlock:^(id responseObject, NSError *error) {
//        [weakSelf requestFaild];
//    }];
//}
//
//- (void)queryJobFinderDetailInfo
//{
//    WEAKSELF
//    
//    [self.jobFinderService queryJobfindersDetailWithId:self.jobfinderId successBlock:^(id responseObject) {
//        
//        if ([weakSelf isValidateResponseData:responseObject]) {
//            DDJobfinderDetailInfo *jobfinderInfo = [DDJobfinderDetailInfo yy_modelWithJSON:responseObject[@"data"]];
//            weakSelf.detailInfo = jobfinderInfo;
//            [weakSelf updateViewWithInfo];
//            
//        } else {
//            [weakSelf responseUnValidate:responseObject];
//        }
//    } failBlock:^(id responseObject, NSError *error) {
//        [weakSelf requestFaild];
//    }];
//}
//
//- (void)updateViewWithInfo
//{
//    self.title = self.detailInfo.name;
//    
//    // 牛人信息cell
//    DDJobfinderInfoCell *cell = (DDJobfinderInfoCell *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
//    [cell updateInfoWith:self.detailInfo];
//    
//    DDHighLightCell *highlightCell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]];
//    [highlightCell updateHighlightInfoWith:self.detailInfo];
//    
//    
//    DDWorkExperienceCell *workCell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]];
//    
//    if ([self.detailInfo.workexperience count] > 0) {
//        DDWorkExperienceDetail *workDetail = self.detailInfo.workexperience[0];
//        workCell.companyLabel.text = workDetail.companyname;
//        workCell.experienceLabel.text = [NSString stringWithFormat:@"%@-%@",workDetail.startdate,workDetail.enddate];
//        workCell.jobTitleLabel.text = workDetail.jobtitle;
//    }
//    
//    if ([self.detailInfo.eduexperience count] > 0) {
//        DDEduExperienceDetail *eduDetail = self.detailInfo.eduexperience[0];
//        DDEduExperienceCell *eduCell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:3 inSection:0]];
//        eduCell.eduNameLabel.text = eduDetail.institutename;
//        eduCell.eduExperienceLabel.text = [NSString stringWithFormat:@"%@-%@",eduDetail.startdate,eduDetail.enddate];
//        eduCell.specialityLabel.text = [NSString stringWithFormat:@"%@ | %@",eduDetail.majortitle,eduDetail.edu];
//    }
//}
//
//#pragma mark
//#pragma mark - Event Response
//
//- (IBAction)onBossInterestingButtonClick:(UIButton *)sender {
//
//    [self markInterstStatus];
//}
//
//- (IBAction)onBossChatButtonClick:(UIButton *)sender {
//    
//    DDChatMessageViewController *vc = [[DDChatMessageViewController alloc] init];
//    if (self.detailInfo) {
//        vc.targetId = [NSString stringWithFormat:@"%@_jobfinder",self.jobfinderId];
//        vc.title = self.detailInfo.name;
//        NSLog(@"_________  %@",vc.targetId);
//    }
//    else {
//        vc.targetId = @"3";
//    }
//    /// 如果有jobdetail，传入聊天界面进行缓存
//    if (self.detailInfo) {
//        //        vc.jobid = self.detailInfo.jobid;
//    }
//    
//    ///	缓存jobdetail
//    //    [[DDCommunicatedStore sharedStore] storeCommunicatedBoss:self.jobDetail];
//    
//    [self.navigationController pushViewController:vc animated:YES];
//    
//    // 选职位
////    DDBossChoosePositionViewController *chooseVC = [[DDBossChoosePositionViewController alloc] init];
////    [self.navigationController pushViewController:chooseVC animated:YES];
//}
//
//#pragma mark
//#pragma mark - CustomDelegate
//
//#pragma mark - UITableView DataSource
//
//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
//{
//    return 1;
//}
//
//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//    return [self.rowHeightArray count];
//}
//
//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
//{
//    return .1f;
//}
//
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//{
////    if (indexPath.row == 1) {
////        DDHighLightCell *highlightCell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]];
////        
////        return highlightCell.frame.size.height;
////    }
//    return [self.rowHeightArray[indexPath.row] floatValue];
//}
//
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    UITableViewCell *cell = nil;
//    
//    if (indexPath.row == 0) {
//        cell = (DDJobfinderInfoCell *)[tableView dequeueReusableCellWithIdentifier:@"DDJobfinderInfoCell"];
//        
//    } else if (indexPath.row == 1) {
//        cell = (DDHighLightCell *)[tableView dequeueReusableCellWithIdentifier:@"DDHighLightCell"];
//        
//    } else if (indexPath.row == 2) {
//        cell = (DDWorkExperienceCell *)[tableView dequeueReusableCellWithIdentifier:@"DDWorkExperienceCell"];
//        
//    } else if (indexPath.row == 3) {
//        cell = (DDEduExperienceCell *)[tableView dequeueReusableCellWithIdentifier:@"DDEduExperienceCell"];        
//    }
//    
//    cell.selectionStyle = UITableViewCellSelectionStyleNone;
//    
//    return cell;
//}
//
//- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    [tableView deselectRowAtIndexPath:indexPath animated:YES];
//}
//
//#pragma mark
//#pragma mark - Getters and Setters
//
//
//@end
